/*
 * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
 *
 * SPDX-License-Identifier: CC0-1.0
 */

#include "c3_main.h"
//#include "zhongduan.h" //中断
//#include "gattc_demo.h"

#include "esp_log.h"

static const char *TAG = "c3_main: ";
#define led_pin GPIO_NUM_2
#define led_deng_dai GPIO_NUM_20

// 多线程,定义消息缓冲区句柄
MessageBufferHandle_t zhuanFanP; // 所有接收到的消息转发
QueueHandle_t ledPwmLD;          // 中断启用与关闭消息队列

void xin_pian_xin_xi() // 打印芯片信息
{
    /* *******************打印芯片信息*********** */
    esp_chip_info_t chip_info;
    uint32_t flash_size;
    esp_chip_info(&chip_info);
    printf("This is %s chip with %d CPU core(s), %s%s%s%s, ",
           CONFIG_IDF_TARGET,
           chip_info.cores,
           (chip_info.features & CHIP_FEATURE_WIFI_BGN) ? "WiFi/" : "",
           (chip_info.features & CHIP_FEATURE_BT) ? "BT" : "",
           (chip_info.features & CHIP_FEATURE_BLE) ? "BLE" : "",
           (chip_info.features & CHIP_FEATURE_IEEE802154) ? ", 802.15.4 (Zigbee/Thread)" : "");

    unsigned major_rev = chip_info.revision / 100;// 获取芯片版本号 
    unsigned minor_rev = chip_info.revision % 100;
    printf("silicon revision v%d.%d, ", major_rev, minor_rev);
    if (esp_flash_get_size(NULL, &flash_size) != ESP_OK)
    {
        printf("Get flash size failed");
        return;
    }

    printf("%" PRIu32 "MB %s flash\n", flash_size / (uint32_t)(1024 * 1024),
           (chip_info.features & CHIP_FEATURE_EMB_FLASH) ? "embedded" : "external");

    printf("Minimum free heap size: %" PRIu32 " bytes\r\n", esp_get_minimum_free_heap_size());
    ESP_LOGI(TAG, "芯片信息打印完毕\r\n");
    /***************** 打印芯片信息******** */
}
void app_main(void)
{
    //zhong_duan_init();
    ESP_LOGE("GATTC_TAG01", "ok001 enable bluetooth failed\n");
    //xin_pian_xin_xi();
    ESP_LOGE("GATTC_TAG02", "ok001 enable bluetooth failed\n");
    while (1)
    {
        vTaskDelay(pdMS_TO_TICKS(2000));
        ESP_LOGE("GATTC_TAG", "ok001 enable bluetooth failed  \n");
    }
}
